package com.socialuni.model.DO.user;

import com.socialuni.base.constants.GenderType;
import com.socialuni.base.constants.UserType;
import com.socialuni.base.constants.status.UserStatus;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "s_user",
        //查询条件索引，索引列不能为空
        indexes = {
                @Index(columnList = "gender"),
                @Index(columnList = "nickname"),
                @Index(columnList = "age"),
                @Index(columnList = "status"),
                @Index(columnList = "type"),
        },
        //手机号唯一
        uniqueConstraints = {
                @UniqueConstraint(columnNames = "phoneNum")
        }
)
@Data
public class SocialUserDO {
    //在talk里面展示的放在user里？
    //必有
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    @Column(nullable = false, columnDefinition = "varchar(50) default '未设置昵称'")
    private String nickname;
    @Column(nullable = false, columnDefinition = "varchar(255) default ''")
    private String avatar;
    @Column(nullable = false, columnDefinition = "varchar(20) default '" + GenderType.girl + "'")
    private String gender;
    //仅在个人页面或者许改时展示，或者仅个人可见
    @Column(nullable = false, columnDefinition = "varchar(20) default '2022-01-01'")
    private String birthday;
    @Column(nullable = false, columnDefinition = "int default 19")
    private Integer age;
    @Column(nullable = false, columnDefinition = "varchar(20) default '" + UserStatus.enable + "'")
    private String status;
    @Column(nullable = false)
    private Date createTime;
    @Column(nullable = false)
    private Date updateTime;
    //用户类型，系统，通知，普通
    @Column(nullable = false, columnDefinition = "varchar(20) default '" + UserType.personal + "'")
    private String type;
    @Column(nullable = false, columnDefinition = "varchar(100) default '未知'")
    private String city;
    //phoneCountryCode
    @Column(nullable = false, columnDefinition = "varchar(20) default '86'")
    private String phoneCountryCode;
    @Column(nullable = false, columnDefinition = "varchar(20) default ''")
    private String phoneNum;
    @Column(nullable = false)
    private String platform;
    @Column(nullable = false)
    private String provider;
}